package com.atos.howl.chaos.utils;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * @author Howl-Xu
 * @version 1.0.0
 * @Description: 请描述一下这个类文件吧
 * @createTime 2020年02月12日 11:07:00
 */
public class ChaosUtils {
    public static String getLoginUserUUID(){
        // 获得request对象,从request对象里拿token
        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        HttpServletRequest request = attributes.getRequest();
        String token = request.getHeader("token");
        return TokenUtils.getLoginUserUUID(token);
    }
}
